follow these rules to fix code:
1. code it as a part of project, dont code the code i give you as a single project.
2. keep header file, and dont import unknown code or libraries.
3. dont add other libraries, just code this file.

and follow these errors:
1. Redesign the UI to conform to aesthetics and ensure that every position is just right.

and here's the code:
(menu.cpp):
// menu.cpp
#define IMGUI_DEFINE_MATH_OPERATORS

#include "menu.h"
#include <filesystem>

#include "variables.h"
#include "interfaces.h"
#include "../sdk/interfaces/iengineclient.h"
#include "../sdk/interfaces/inetworkclientservice.h"
#include "../sdk/interfaces/cgameentitysystem.h"
#include "../features/modelchanger/modelchanger.h"
#include "../sdk/interfaces/iglobalvars.h"
#include "../sdk/interfaces/ienginecvar.h"
#include "../features/visuals/overlay.h"
#include <format>

#include "sdk.h"
#include "../features/antiaim/antiaim.hpp"
#include "../utilities/inputsystem.h"

#include <vector>
#include <string>
#include <cmath>
#include <functional>

#define ALPHA (ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_AlphaBar | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_Float | ImGuiColorEditFlags_NoDragDrop | ImGuiColorEditFlags_PickerHueBar | ImGuiColorEditFlags_NoBorder)
#define NO_ALPHA (ImGuiColorEditFlags_NoTooltip | ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel | ImGuiColorEditFlags_NoAlpha | ImGuiColorEditFlags_InputRGB | ImGuiColorEditFlags_Float | ImGuiColorEditFlags_NoDragDrop | ImGuiColorEditFlags_PickerHueBar | ImGuiColorEditFlags_NoBorder)

#pragma region menu_array_entries
static constexpr const char* arrMiscDpiScale[] = {
	"100%",
	"125%",
	"150%",
	"175%",
	"200%"
};

static constexpr const char* arrEspFlags[] = {
	"KIT",
	"ARMOR",
	"DEFUSER",
	"SCOPED"
};

static const std::pair<const char*, const std::size_t> arrColors[] = {
	{ "[accent] - main", Vars.colAccent0 },
	{ "[accent] - dark (hover)", Vars.colAccent1 },
	{ "[accent] - darker (active)", Vars.colAccent2 },
	{ "[primitive] - text", Vars.colPrimtv0 },
	{ "[primitive] - background", Vars.colPrimtv1 },
	{ "[primitive] - disabled", Vars.colPrimtv2 },
	{ "[primitive] - frame background", Vars.colPrimtv3 },
};

static constexpr const char* arrMenuAddition[] = {
	"glow",
	"particle",
	"dim"
};

static constexpr const char* arrHitboxes[] = {
	"HEAD",
	"NECK",
	"CHEST",
	"STOMACH",
	"CENTER",
	"PELVIS",
	"LEG",
	"FEET",
};

static const std::vector<const char*> mainTabs = { "RageBot", "AntiAim", "Visuals", "Misc", "Config" };
static const std::vector<const char*> mainTabsIcons = { "N", "Q", "I", "O", "S" };
static const std::vector<const char*> visualsSubTabs = { "Players", "Weapons", "World", "View" };

#pragma endregion

static int nCurrentMainTab = 0;
static int nVisualTab = 0;
static int nSelectedConfig = -1;
static char szConfigFile[MAX_PATH] = {};
static bool settings_window = false;
static float flTabAnimation = 1.f;
static float flSubTabAnimation = 1.f;

namespace ImGui
{
	bool Tab(const char* icon, const char* label, bool selected)
	{
		ImGuiWindow* window = GetCurrentWindow();
		if (window->SkipItems)
			return false;

		ImGuiContext& g = *GImGui;
		const ImGuiStyle& style = g.Style;
		const ImGuiID id = window->GetID(label);
		const ImVec2 label_size = CalcTextSize(label, NULL, true);
		ImVec2 pos = window->DC.CursorPos;

		const ImVec2 size = CalcItemSize(ImVec2(40 * MENU::flDpiScale, 40 * MENU::flDpiScale), label_size.x + style.FramePadding.x * 2.0f, label_size.y + style.FramePadding.y * 2.0f);

		const ImRect bb(pos, pos + size);
		ItemSize(size, style.FramePadding.y);
		if (!ItemAdd(bb, id))
			return false;

		bool hovered, held;
		bool pressed = ButtonBehavior(bb, id, &hovered, &held, 0);

		if (selected)
			window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_ButtonActive), style.FrameRounding);
		else if (hovered || held)
			window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_ButtonHovered), style.FrameRounding);
		else
			window->DrawList->AddRectFilled(bb.Min, bb.Max, GetColorU32(ImGuiCol_Button), style.FrameRounding);

		ImVec4 text_color = selected ? GetStyleColorVec4(ImGuiCol_Text) : (hovered ? GetStyleColorVec4(ImGuiCol_Text) : GetStyleColorVec4(ImGuiCol_TextDisabled));
		PushStyleColor(ImGuiCol_Text, text_color);
		RenderTextClipped(bb.Min + style.FramePadding, bb.Max - style.FramePadding, label, NULL, &label_size, style.SelectableTextAlign, &bb);
		PopStyleColor();

		return pressed;
	}

	bool SubTab(const char* label, bool selected)
	{
		ImGuiWindow* window = GetCurrentWindow();
		if (window->SkipItems)
			return false;

		ImGuiContext& g = *GImGui;
		const ImGuiStyle& style = g.Style;
		const ImGuiID id = window->GetID(label);
		const ImVec2 label_size = CalcTextSize(label, NULL, true);
		ImVec2 pos = window->DC.CursorPos;

		const ImRect bb(pos, pos + label_size + style.FramePadding * 2);
		ItemSize(bb.GetSize(), style.FramePadding.y);
		if (!ItemAdd(bb, id))
			return false;

		bool hovered, held;
		bool pressed = ButtonBehavior(bb, id, &hovered, &held, ImGuiButtonFlags_PressedOnClick | ImGuiButtonFlags_AllowItemOverlap);

		if (selected)
		{
			window->DrawList->AddText(bb.Min + style.FramePadding, GetColorU32(ImGuiCol_Text), label);
			window->DrawList->AddLine(bb.GetBL() + ImVec2(0, 1 * MENU::flDpiScale), bb.GetBR() + ImVec2(0, 1 * MENU::flDpiScale), GetColorU32(ImGuiCol_CheckMark), 2.0f * MENU::flDpiScale);
		}
		else if (hovered)
		{
			window->DrawList->AddText(bb.Min + style.FramePadding, GetColorU32(ImGuiCol_Text), label);
		}
		else
		{
			window->DrawList->AddText(bb.Min + style.FramePadding, GetColorU32(ImGuiCol_TextDisabled), label);
		}

		return pressed;
	}

	void BeginChildStyled(const char* str_id, const ImVec2& size)
	{
		ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10 * MENU::flDpiScale, 10 * MENU::flDpiScale));
		ImGui::PushStyleColor(ImGuiCol_ChildBg, ImGui::GetStyleColorVec4(ImGuiCol_FrameBg));
		ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 0.0f);
		ImGui::BeginChild(str_id, size, false, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse);
	}

	void EndChildStyled()
	{
		ImGui::EndChild();
		ImGui::PopStyleVar();
		ImGui::PopStyleColor();
		ImGui::PopStyleVar();
	}

	void TabArea(const char* str_id, const ImVec2& size, std::function<void()> content)
	{
		ImGui::BeginChild(str_id, size);
		content();
		ImGui::EndChild();
	}
}

void MENU::RenderMainWindow()
{
	ImGuiIO& io = ImGui::GetIO();
	ImGuiStyle& style = ImGui::GetStyle();

	if (!bMainWindowOpened)
		return;

	flDpiScale = D::CalculateDPI(C_GET(int, Vars.nDpiScale));
	const ImVec2 vecScreenSize = io.DisplaySize;

	UpdateStyle(&style);

	float window_width = 900 * flDpiScale;
	float window_height = 624 * flDpiScale;
	float tab_area_width = 60 * flDpiScale;
	float content_area_x_start = tab_area_width + style.WindowPadding.x; // Adjusted for padding

	ImGui::SetNextWindowSize(ImVec2(window_width, window_height), ImGuiCond_Always);
	ImGui::SetNextWindowPos(ImVec2(vecScreenSize.x * 0.5f, vecScreenSize.y * 0.5f), ImGuiCond_Once, ImVec2(0.5f, 0.5f));

	ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(5 * flDpiScale, 5 * flDpiScale)); // Overall window padding
	ImGui::PushStyleVar(ImGuiStyleVar_WindowMinSize, ImVec2(window_width, window_height));
	ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);

	ImGui::Begin("Xenon", &bMainWindowOpened, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse);
	{
		ImGuiWindow* window = ImGui::GetCurrentWindow();
		ImDrawList* draw_list = window->DrawList;
		ImVec2 p = window->Pos;
		ImVec2 size = window->Size;

		draw_list->AddRectFilled(p, p + size, ImGui::GetColorU32(ImGuiCol_WindowBg, 0.8f), style.WindowRounding);

		ImGui::SetCursorPos(ImVec2(style.WindowPadding.x, style.WindowPadding.y));

		ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(style.ItemSpacing.x, style.ItemSpacing.y * flDpiScale));
		ImGui::TabArea("##tab_area", ImVec2(tab_area_width, size.y - style.WindowPadding.y * 2 - 20 * flDpiScale), [&]()
		{
			for (int i = 0; i < mainTabs.size(); ++i) {
				if (ImGui::Tab(mainTabsIcons.at(i), mainTabs.at(i), nCurrentMainTab == i)) {
					if (nCurrentMainTab != i) {
						nCurrentMainTab = i;
						flTabAnimation = 0.f;
						flSubTabAnimation = 0.f; // Reset sub-tab animation too
					}
				}
			} });
		ImGui::PopStyleVar();

		flTabAnimation = ImLerp(flTabAnimation, 1.f, io.DeltaTime * 8.f); // Example animation lerp
		flSubTabAnimation = ImLerp(flSubTabAnimation, 1.f, io.DeltaTime * 8.f); // Example animation lerp

		ImGui::SetCursorPos(ImVec2(content_area_x_start, style.WindowPadding.y));
		ImGui::BeginGroup(); // Group for content area (subtabs + main content)

		float sub_tab_y_pos = style.WindowPadding.y + 13 * flDpiScale;
		float content_y_start = style.WindowPadding.y + 50 * flDpiScale;
		float separator_y_pos = style.WindowPadding.y + 40 * flDpiScale;

		ImGui::SetCursorPos(ImVec2(content_area_x_start + 10 * flDpiScale, sub_tab_y_pos));
		ImGui::BeginGroup(); // Group for sub-tabs
		{
			ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(15 * flDpiScale, style.ItemSpacing.y));
			if (nCurrentMainTab == 2) // Visuals Tab
			{
				for (int i = 0; i < visualsSubTabs.size(); ++i)
				{
					if (ImGui::SubTab(visualsSubTabs.at(i), nVisualTab == i))
					{
						if (nVisualTab != i)
						{
							nVisualTab = i;
							flSubTabAnimation = 0.f;
						}
					}
					if (i < visualsSubTabs.size() - 1)
						ImGui::SameLine();
				}
			}
			// Add other sub-tab groups here if needed for other main tabs
			// else if (nCurrentMainTab == X) { ... }
			ImGui::PopStyleVar();
		}
		ImGui::EndGroup();

		draw_list->AddLine(p + ImVec2(content_area_x_start + 5 * flDpiScale, separator_y_pos), p + ImVec2(size.x - style.WindowPadding.x - 5 * flDpiScale, separator_y_pos), ImColor(1.f, 1.f, 1.f, 0.08f));

		ImGui::SetCursorPos(ImVec2(content_area_x_start + 5 * flDpiScale, content_y_start));
		ImGui::BeginChild("##main_content_child", ImVec2(size.x - content_area_x_start - style.WindowPadding.x * 2, size.y - content_y_start - style.WindowPadding.y - 20 * flDpiScale), false, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse);
		{
			switch (nCurrentMainTab)
			{
			case 0:
				T::RageBot();
				break;
			case 1:
				T::AntiAim();
				break;
			case 2:
				T::Visuals();
				break;
			case 3:
				T::Miscellaneous();
				break;
			case 4:
				T::Configs();
				break;
			default:
				break;
			}
		}
		ImGui::EndChild();

		ImGui::EndGroup(); // End content area group

		// Footer
		ImVec2 footer_pos = p + ImVec2(style.WindowPadding.x, size.y - 20 * flDpiScale);
		ImVec2 footer_size = ImVec2(size.x - style.WindowPadding.x * 2, 20 * flDpiScale);
		draw_list->AddRectFilled(footer_pos, footer_pos + footer_size, ImGui::GetColorU32(ImGuiCol_FrameBg), style.FrameRounding, ImDrawFlags_RoundCornersBottom); // Match child bg
		draw_list->AddText(footer_pos + ImVec2(5 * flDpiScale, 2 * flDpiScale), ImGui::GetColorU32(ImGuiCol_TextDisabled), "Xenon for Counter-Strike 2");
		const char* versionText = "v1.0.0"; // Example version
		ImVec2 versionTextSize = ImGui::CalcTextSize(versionText);
		draw_list->AddText(footer_pos + ImVec2(footer_size.x - versionTextSize.x - 5 * flDpiScale, 2 * flDpiScale), ImGui::GetColorU32(ImGuiCol_TextDisabled), versionText);
	}
	ImGui::End();
	ImGui::PopStyleVar(3);

	if (settings_window)
	{
		ImGui::SetNextWindowSize(ImVec2(450 * flDpiScale, 400 * flDpiScale), ImGuiCond_Always);
		ImGui::SetNextWindowPos(ImVec2(vecScreenSize.x * 0.5f, vecScreenSize.y * 0.5f), ImGuiCond_Once, ImVec2(0.5f, 0.5f));

		ImGui::Begin("Settings", &settings_window, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoCollapse);
		{
			if (ImGui::BeginCombo("DPI scale", arrMiscDpiScale[C_GET(int, Vars.nDpiScale)]))
			{
				for (int i = 0; i < IM_ARRAYSIZE(arrMiscDpiScale); i++)
				{
					if (ImGui::Selectable(arrMiscDpiScale[i], (C_GET(int, Vars.nDpiScale) == i)))
						C_GET(int, Vars.nDpiScale) = i;
				}
				ImGui::EndCombo();
			}

			ImGui::Text("Additional Settings");
			ImGui::Indent();
			bool glow_selected = (C_GET(unsigned int, Vars.bMenuAdditional) & MENU_ADDITION_GLOW);
			bool particle_selected = (C_GET(unsigned int, Vars.bMenuAdditional) & MENU_ADDITION_BACKGROUND_PARTICLE);
			bool dim_selected = (C_GET(unsigned int, Vars.bMenuAdditional) & MENU_ADDITION_DIM_BACKGROUND);

			if (ImGui::Checkbox(arrMenuAddition[0], &glow_selected))
			{
				if (glow_selected)
					C_GET(unsigned int, Vars.bMenuAdditional) |= MENU_ADDITION_GLOW;
				else
					C_GET(unsigned int, Vars.bMenuAdditional) &= ~MENU_ADDITION_GLOW;
			}
			if (ImGui::Checkbox(arrMenuAddition[1], &particle_selected))
			{
				if (particle_selected)
					C_GET(unsigned int, Vars.bMenuAdditional) |= MENU_ADDITION_BACKGROUND_PARTICLE;
				else
					C_GET(unsigned int, Vars.bMenuAdditional) &= ~MENU_ADDITION_BACKGROUND_PARTICLE;
			}
			if (ImGui::Checkbox(arrMenuAddition[2], &dim_selected))
			{
				if (dim_selected)
					C_GET(unsigned int, Vars.bMenuAdditional) |= MENU_ADDITION_DIM_BACKGROUND;
				else
					C_GET(unsigned int, Vars.bMenuAdditional) &= ~MENU_ADDITION_DIM_BACKGROUND;
			}
			ImGui::Unindent();

			ImGui::SliderFloat("Animation Speed", &C_GET(float, Vars.flAnimationSpeed), 1.f, 10.f);
		}
		ImGui::End();
	}
}

void MENU::RenderOverlayPreviewWindow()
{
	using namespace F::VISUALS::OVERLAY;

	ImGuiStyle& style = ImGui::GetStyle();
	ImGuiWindow* main_window = ImGui::FindWindowByName("Xenon");
	if (!main_window)
		return;

	ImVec2 vecMenuPos = main_window->Pos;
	ImVec2 vecMenuSize = main_window->Size;

	const ImVec2 vecOverlayPadding = ImVec2(30.f * flDpiScale, 50.f * flDpiScale);
	ImVec2 previewWindowSize = ImVec2(240 * flDpiScale, vecMenuSize.y);

	ImGui::SetNextWindowPos(ImVec2(vecMenuPos.x + vecMenuSize.x + style.WindowPadding.x, vecMenuPos.y), ImGuiCond_Always);
	ImGui::SetNextWindowSize(previewWindowSize, ImGuiCond_Always);
	ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
	ImGui::Begin("Preview", &bMainWindowOpened, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize);
	{
		ImDrawList* pDrawList = ImGui::GetWindowDrawList();
		ImDrawList* pBackgroundDrawList = ImGui::GetBackgroundDrawList();
		ImVec2 vecWindowPos = ImGui::GetWindowPos();
		ImVec2 vecWindowSize = ImGui::GetWindowSize();

		pBackgroundDrawList->AddRectFilled(vecWindowPos, vecWindowPos + vecWindowSize, ImGui::GetColorU32(ImGuiCol_WindowBg, 0.8f), style.WindowRounding); // Use main style

		Context_t context;

		ImVec4 vecBox = {
			vecWindowPos.x + vecOverlayPadding.x,
			vecWindowPos.y + vecOverlayPadding.y,
			vecWindowPos.x + vecWindowSize.x - vecOverlayPadding.x,
			vecWindowPos.y + vecWindowSize.y - vecOverlayPadding.y
		};

		if (const auto& boxOverlayConfig = C_GET(FrameOverlayVar_t, Vars.overlayBox); boxOverlayConfig.bEnable)
		{
			pDrawList->AddRect(ImVec2(vecBox.x, vecBox.y), ImVec2(vecBox.z, vecBox.w), boxOverlayConfig.colPrimary.GetU32(), boxOverlayConfig.flRounding, ImDrawFlags_None, boxOverlayConfig.flThickness);
			pDrawList->AddRect(ImVec2(vecBox.x - 1, vecBox.y - 1), ImVec2(vecBox.z + 1, vecBox.w + 1), boxOverlayConfig.colOutline.GetU32(), boxOverlayConfig.flRounding, ImDrawFlags_None, 1.0f);
			pDrawList->AddRect(ImVec2(vecBox.x + 1, vecBox.y + 1), ImVec2(vecBox.z - 1, vecBox.w - 1), boxOverlayConfig.colOutline.GetU32(), boxOverlayConfig.flRounding, ImDrawFlags_None, 1.0f);

			if (ImGui::IsMouseHoveringRect(ImVec2(vecBox.x, vecBox.y), ImVec2(vecBox.z, vecBox.w)) && ImGui::IsMouseClicked(ImGuiMouseButton_Right))
				ImGui::OpenPopup("context##box.component");
		}

		if (const auto& nameOverlayConfig = C_GET(TextOverlayVar_t, Vars.overlayName); nameOverlayConfig.bEnable)
			pDrawList->AddText(ImVec2(vecBox.x + (vecBox.z - vecBox.x) / 2.f - ImGui::CalcTextSize("Xenon").x / 2.f, vecBox.y - ImGui::GetTextLineHeight() - 2 * flDpiScale), nameOverlayConfig.colPrimary.GetU32(), "Xenon");

		if (const auto& healthOverlayConfig = C_GET(BarOverlayVar_t, Vars.overlayHealthBar); healthOverlayConfig.bEnable)
		{
			float flFactor = 0.75f;
			float barHeight = vecBox.w - vecBox.y;
			float barWidth = 4.f * flDpiScale;
			pDrawList->AddRectFilled(ImVec2(vecBox.x - barWidth - 2 * flDpiScale, vecBox.y), ImVec2(vecBox.x - 2 * flDpiScale, vecBox.w), healthOverlayConfig.colBackground.GetU32());
			pDrawList->AddRectFilled(ImVec2(vecBox.x - barWidth - 2 * flDpiScale, vecBox.y + barHeight * (1.f - flFactor)), ImVec2(vecBox.x - 2 * flDpiScale, vecBox.w), healthOverlayConfig.colPrimary.GetU32());
		}

		if (const auto& armorOverlayConfig = C_GET(BarOverlayVar_t, Vars.overlayArmorBar); armorOverlayConfig.bEnable)
		{
			float flArmorFactor = 0.6f;
			float barWidth = vecBox.z - vecBox.x;
			float barHeight = 4.f * flDpiScale;
			pDrawList->AddRectFilled(ImVec2(vecBox.x, vecBox.w + 2 * flDpiScale), ImVec2(vecBox.z, vecBox.w + 2 * flDpiScale + barHeight), armorOverlayConfig.colBackground.GetU32());
			pDrawList->AddRectFilled(ImVec2(vecBox.x, vecBox.w + 2 * flDpiScale), ImVec2(vecBox.x + barWidth * flArmorFactor, vecBox.w + 2 * flDpiScale + barHeight), armorOverlayConfig.colPrimary.GetU32());
		}

		if (ImGui::BeginPopup("context##box.component", ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove))
		{
			ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(style.FramePadding.x, 0));
			ImGui::ColorEdit4("primary color##box.component", &C_GET(FrameOverlayVar_t, Vars.overlayBox).colPrimary);
			ImGui::ColorEdit4("outline color##box.component", &C_GET(FrameOverlayVar_t, Vars.overlayBox).colOutline);
			ImGui::SetNextItemWidth(ImGui::GetWindowWidth() * 0.75f);
			ImGui::SliderFloat("thickness##box.component", &C_GET(FrameOverlayVar_t, Vars.overlayBox).flThickness, 1.f, 5.f, "%.1f", ImGuiSliderFlags_AlwaysClamp);
			ImGui::SetNextItemWidth(ImGui::GetWindowWidth() * 0.75f);
			ImGui::SliderFloat("rounding##box.component", &C_GET(FrameOverlayVar_t, Vars.overlayBox).flRounding, 1.f, 5.f, "%.1f", ImGuiSliderFlags_AlwaysClamp);
			ImGui::PopStyleVar();
			ImGui::EndPopup();
		}
	}
	ImGui::End();
	ImGui::PopStyleVar();
}

inline const char* GetExtractedWeaponNameMenu(C_CSWeaponBase* weapon)
{
	if (!weapon)
		return "";

	auto weapon_data = weapon->GetWeaponVData();
	if (!weapon_data)
		return "";

	const char* szWeaponName = weapon_data->GetName();
	const char* weaponPrefix = "weapon_";
	const char* weaponNameStart = strstr(szWeaponName, weaponPrefix);
	const char* extractedWeaponName = weaponNameStart ? weaponNameStart + strlen(weaponPrefix) : szWeaponName;

	return extractedWeaponName;
}

int GetWeaponIndex()
{
	if (!SDK::LocalPawn || !SDK::LocalPawn->IsAlive())
		return -1;

	auto active_weapon = SDK::LocalPawn->GetActiveWeaponFromPlayer();
	if (active_weapon != nullptr)
	{
		auto pWeaponVData = active_weapon->GetWeaponVData();
		if (pWeaponVData != nullptr)
		{
			const char* extractedWeaponName = GetExtractedWeaponNameMenu(active_weapon);
			if (!extractedWeaponName || extractedWeaponName[0] == '\0')
				return 0; // Default if name is bad

			bool has_awp = strcmp(extractedWeaponName, "awp") == 0;
			bool has_heavy_pistols = strcmp(extractedWeaponName, "revolver") == 0 || strcmp(extractedWeaponName, "deagle") == 0;
			bool has_scout = strcmp(extractedWeaponName, "ssg08") == 0;

			if (has_awp)
				return 6;
			else if (has_scout)
				return 5;
			else if (has_heavy_pistols)
				return 2;
			else if (pWeaponVData->GetWeaponType() == WEAPONTYPE_PISTOL && !has_heavy_pistols)
				return 1;
			else if (pWeaponVData->GetWeaponType() == WEAPONTYPE_MACHINEGUN)
				return 3;
			else if (pWeaponVData->GetWeaponType() == WEAPONTYPE_RIFLE)
				return 3;
			else if (pWeaponVData->GetWeaponType() == WEAPONTYPE_SUBMACHINEGUN)
				return 4;
			else if (pWeaponVData->GetWeaponType() == WEAPONTYPE_SNIPER_RIFLE && !has_awp && !has_scout)
				return 4;
			else
				return 0;
		}
	}

	return 0; // Return default if no weapon active
}

std::uint32_t get_handle_entity(C_CSPlayerPawn* entity)
{
	if (!entity)
		return static_cast<std::uint32_t>(-1); // Return invalid handle

	using fn_get_handle_entity = std::uint32_t(__fastcall*)(C_CSPlayerPawn*);
	// Ensure pattern is found only once
	static fn_get_handle_entity fn = nullptr;
	if (!fn)
	{
		fn = reinterpret_cast<fn_get_handle_entity>(MEM::FindPattern(CLIENT_DLL, "48 85 C9 74 32 48 8B 41 10 48 85 C0 74 29 44"));
	}

	if (!fn)
		return static_cast<std::uint32_t>(-1); // Handle pattern not found

	return fn(entity);
}

void MENU::RenderKeybinds()
{
	if (C_GET(bool, Vars.bKeybindList))
	{
		ImGui::SetNextWindowBgAlpha(0.f);
		ImGui::SetNextWindowSize(ImVec2(165, 150));
		ImGui::Begin("Hotkeys", nullptr, ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoResize);
		{
			ImGuiStyle& style = ImGui::GetStyle();
			style.WindowBorderSize = 0.0f;
			auto background_list = ImGui::GetBackgroundDrawList();
			auto draw_list = ImGui::GetWindowDrawList();
			ImVec2 xy = ImGui::GetWindowPos();

			ImVec2 rect_min = ImGui::GetCursorScreenPos();
			ImVec2 rect_max = ImVec2(rect_min.x + 140, rect_min.y + 30);

			float rounding = 7.0f;

			// Ðèñóåì çàïîëíåííûé ïðÿìîóãîëüíèê ñ çàêðóãëåííûìè óãëàìè
			draw_list->AddRectFilled(rect_min, rect_max, IM_COL32(17, 17, 18, 255), rounding); // ×åðíî-ñåðûé öâåò (RGBA)
			background_list->AddRectFilled(xy, ImVec2(xy.x + 140, xy.y + 30), ImColor(26, 28, 96)); // Glow effect

			// Ðèñóåì òåêñò, ñäâèíóâ åãî åùå íà 2 ïèêñåëÿ âïðàâî
			draw_list->AddText(FONT::pMain, 17.f, ImVec2(xy.x + 50, xy.y + 14), ImColor(255, 255, 255, 255), "Hotkeys"); // Name

			ImGui::Dummy(ImVec2(10.f, 0.f));
			ImGui::Dummy(ImVec2(10.f, 0.f));
			ImGui::Dummy(ImVec2(10.f, 0.f));
			ImGui::Dummy(ImVec2(10.f, 0.f));
			ImGui::Dummy(ImVec2(10.f, 0.f));
			ImGui::Dummy(ImVec2(10.f, 0.f));
			ImGui::Dummy(ImVec2(10.f, 0.f));
			ImGui::Dummy(ImVec2(10.f, 0.f));
			ImGui::Dummy(ImVec2(10.f, 0.f));

			if (C_GET(bool, Vars.bLegitbot))
				ImGui::Text(CS_XOR("Aim Assist"));

			if (C_GET(bool, Vars.bThirdPerson))
				ImGui::Text(CS_XOR("Third person"));

			if (C_GET(bool, Vars.bAutoFire))
				ImGui::Text(CS_XOR("Autofire"));

			/*if (IPT::GetBindState(C_GET(KeyBind_t, Vars.nBodyAim)))
				ImGui::Text(CS_XOR("Body Aim"));*/

			try
			{
				int weaponIndex = GetWeaponIndex();
				if (weaponIndex != -1)
				{
					if (C_GET(bool, Vars.bEnableOverrideDamage))
						ImGui::Text(std::format("Override damage [{}]", C_GET_ARRAY(int, 7, Vars.iOverrideDamage, weaponIndex)).c_str());
					else
						ImGui::Text(std::format("Min damage [{}]", C_GET_ARRAY(int, 7, Vars.iMinDamage, weaponIndex)).c_str());
				}
			}
			catch (...)
			{ }

			if (C_GET(KeyBind_t, Vars.nAutoPeekKey).bEnable)
				ImGui::Text(CS_XOR("Auto Peek"));
		}
		ImGui::End();
	}
};

auto Temp() -> C_CSPlayerPawn*
{
	if (!I::GameResourceService || !I::GameResourceService->pGameEntitySystem)
		return nullptr;

	C_CSPlayerPawn* LocalPlayerPawn = I::GameResourceService->pGameEntitySystem->GetSplitScreenViewPlayer(0);
	if (!LocalPlayerPawn)
		return nullptr;

	SchemaClassInfoData_t* pLocalClassInfo = nullptr;
	LocalPlayerPawn->GetSchemaClassInfo(&pLocalClassInfo);
	if (!pLocalClassInfo || FNV1A::Hash(pLocalClassInfo->szName) != FNV1A::HashConst("C_CSPlayerPawn"))
		return nullptr;

	if (LocalPlayerPawn->IsAlive())
		return LocalPlayerPawn;

	auto pObserverServices = LocalPlayerPawn->GetObserverServices();
	if (!pObserverServices)
		return nullptr;

	auto hObserverTarget = pObserverServices->GetObserverTarget();
	if (!hObserverTarget.IsValid())
		return nullptr;

	auto pObservedPawn = I::GameResourceService->pGameEntitySystem->Get<C_CSPlayerPawn>(hObserverTarget.GetHandleValue());
	if (pObservedPawn)
	{
		SchemaClassInfoData_t* pObservedClassInfo = nullptr;
		pObservedPawn->GetSchemaClassInfo(&pObservedClassInfo);
		if (pObservedClassInfo && FNV1A::Hash(pObservedClassInfo->szName) == FNV1A::HashConst("C_CSPlayerPawn"))
		{
			return pObservedPawn;
		}
	}

	return nullptr;
}

void MENU::UpdateStyle(ImGuiStyle* pStyle)
{
	ImGuiStyle& style = pStyle != nullptr ? *pStyle : ImGui::GetStyle();

	style.WindowRounding = 6.0f * flDpiScale;
	style.ChildRounding = 5.0f * flDpiScale;
	style.FrameRounding = 4.0f * flDpiScale;
	style.PopupRounding = 4.0f * flDpiScale;
	style.ScrollbarRounding = 9.0f * flDpiScale;
	style.GrabRounding = 3.0f * flDpiScale;
	style.TabRounding = 4.0f * flDpiScale;

	style.WindowPadding = ImVec2(8 * flDpiScale, 8 * flDpiScale);
	style.FramePadding = ImVec2(5 * flDpiScale, 5 * flDpiScale);
	style.CellPadding = ImVec2(4 * flDpiScale, 4 * flDpiScale);
	style.ItemSpacing = ImVec2(10 * flDpiScale, 8 * flDpiScale);
	style.ItemInnerSpacing = ImVec2(8 * flDpiScale, 6 * flDpiScale);
	style.ScrollbarSize = 15.0f * flDpiScale;
	style.GrabMinSize = 10.0f * flDpiScale;
	style.IndentSpacing = 21.0f * flDpiScale;

	style.Colors[ImGuiCol_Text] = C_GET(ColorPickerVar_t, Vars.colPrimtv0).colValue.GetVec4(1.f);
	style.Colors[ImGuiCol_TextDisabled] = C_GET(ColorPickerVar_t, Vars.colPrimtv2).colValue.GetVec4(0.5f); // Dimmed more
	style.Colors[ImGuiCol_TextSelectedBg] = C_GET(ColorPickerVar_t, Vars.colAccent1).colValue.GetVec4(0.85f);

	style.Colors[ImGuiCol_WindowBg] = C_GET(ColorPickerVar_t, Vars.colPrimtv1).colValue.GetVec4(0.95f); // Slightly less opaque
	style.Colors[ImGuiCol_ChildBg] = C_GET(ColorPickerVar_t, Vars.colPrimtv3).colValue.GetVec4(0.7f); // Child background like frame
	style.Colors[ImGuiCol_PopupBg] = C_GET(ColorPickerVar_t, Vars.colPrimtv1).colValue.GetVec4(1.0f);
	style.Colors[ImGuiCol_Border] = ImVec4(0.0f, 0.0f, 0.0f, 0.0f);
	style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.0f, 0.0f, 0.0f, 0.0f);

	style.Colors[ImGuiCol_FrameBg] = C_GET(ColorPickerVar_t, Vars.colPrimtv3).colValue.GetVec4(1.0f);
	style.Colors[ImGuiCol_FrameBgHovered] = C_GET(ColorPickerVar_t, Vars.colAccent1).colValue.GetVec4(0.8f);
	style.Colors[ImGuiCol_FrameBgActive] = C_GET(ColorPickerVar_t, Vars.colAccent2).colValue.GetVec4(0.6f);

	style.Colors[ImGuiCol_TitleBg] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(0.20f);
	style.Colors[ImGuiCol_TitleBgActive] = C_GET(ColorPickerVar_t, Vars.colAccent2).colValue.GetVec4(0.50f);
	style.Colors[ImGuiCol_TitleBgCollapsed] = C_GET(ColorPickerVar_t, Vars.colAccent1).colValue.GetVec4(0.20f);

	style.Colors[ImGuiCol_MenuBarBg] = C_GET(ColorPickerVar_t, Vars.colPrimtv1).colValue.GetVec4(0.70f);

	style.Colors[ImGuiCol_ScrollbarBg] = C_GET(ColorPickerVar_t, Vars.colPrimtv3).colValue.GetVec4(0.30f);
	style.Colors[ImGuiCol_ScrollbarGrab] = C_GET(ColorPickerVar_t, Vars.colAccent2).colValue.GetVec4(1.00f);
	style.Colors[ImGuiCol_ScrollbarGrabHovered] = C_GET(ColorPickerVar_t, Vars.colAccent1).colValue.GetVec4(0.90f);
	style.Colors[ImGuiCol_ScrollbarGrabActive] = C_GET(ColorPickerVar_t, Vars.colAccent2).colValue.GetVec4(0.50f);

	style.Colors[ImGuiCol_CheckMark] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(1.00f);

	style.Colors[ImGuiCol_SliderGrab] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(1.0f);
	style.Colors[ImGuiCol_SliderGrabActive] = C_GET(ColorPickerVar_t, Vars.colAccent1).colValue.GetVec4(0.8f);

	// Button colors adjusted to match example.cpp's tab look (using FrameBg related colors)
	style.Colors[ImGuiCol_Button] = C_GET(ColorPickerVar_t, Vars.colPrimtv3).colValue.GetVec4(0.6f); // Subdued base
	style.Colors[ImGuiCol_ButtonHovered] = C_GET(ColorPickerVar_t, Vars.colAccent1).colValue.GetVec4(0.8f); // Accent on hover
	style.Colors[ImGuiCol_ButtonActive] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(1.0f); // Strong accent on active/selected

	style.Colors[ImGuiCol_Header] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(1.00f);
	style.Colors[ImGuiCol_HeaderHovered] = C_GET(ColorPickerVar_t, Vars.colAccent1).colValue.GetVec4(1.00f);
	style.Colors[ImGuiCol_HeaderActive] = C_GET(ColorPickerVar_t, Vars.colAccent2).colValue.GetVec4(1.0f);

	style.Colors[ImGuiCol_Separator] = C_GET(ColorPickerVar_t, Vars.colPrimtv3).colValue.GetVec4(0.5f); // Less prominent separator
	style.Colors[ImGuiCol_SeparatorHovered] = C_GET(ColorPickerVar_t, Vars.colAccent1).colValue.GetVec4(1.00f);
	style.Colors[ImGuiCol_SeparatorActive] = C_GET(ColorPickerVar_t, Vars.colAccent2).colValue.GetVec4(1.00f);

	style.Colors[ImGuiCol_ResizeGrip] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(1.00f);
	style.Colors[ImGuiCol_ResizeGripHovered] = C_GET(ColorPickerVar_t, Vars.colAccent1).colValue.GetVec4(0.70f);
	style.Colors[ImGuiCol_ResizeGripActive] = C_GET(ColorPickerVar_t, Vars.colAccent2).colValue.GetVec4(1.0f);

	// Tab colors aligned with Button colors for consistency
	style.Colors[ImGuiCol_Tab] = C_GET(ColorPickerVar_t, Vars.colPrimtv3).colValue.GetVec4(0.6f);
	style.Colors[ImGuiCol_TabHovered] = C_GET(ColorPickerVar_t, Vars.colAccent1).colValue.GetVec4(0.85f);
	style.Colors[ImGuiCol_TabActive] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(0.90f);
	style.Colors[ImGuiCol_TabUnfocused] = C_GET(ColorPickerVar_t, Vars.colPrimtv3).colValue.GetVec4(0.5f);
	style.Colors[ImGuiCol_TabUnfocusedActive] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(0.80f);

	style.Colors[ImGuiCol_PlotLines] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(1.00f);
	style.Colors[ImGuiCol_PlotLinesHovered] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(0.50f);
	style.Colors[ImGuiCol_PlotHistogram] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(1.00f);
	style.Colors[ImGuiCol_PlotHistogramHovered] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(0.50f);

	style.Colors[ImGuiCol_TableHeaderBg] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(0.19f);
	style.Colors[ImGuiCol_TableBorderStrong] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(0.31f);
	style.Colors[ImGuiCol_TableBorderLight] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(0.20f);
	style.Colors[ImGuiCol_TableRowBg] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
	style.Colors[ImGuiCol_TableRowBgAlt] = ImVec4(1.00f, 1.00f, 1.00f, 0.06f);

	style.Colors[ImGuiCol_DragDropTarget] = C_GET(ColorPickerVar_t, Vars.colAccent2).colValue.GetVec4(0.80f);
	style.Colors[ImGuiCol_NavHighlight] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(1.0f);
	style.Colors[ImGuiCol_NavWindowingHighlight] = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetVec4(1.0f);
	style.Colors[ImGuiCol_NavWindowingDimBg] = ImVec4(0.80f, 0.80f, 0.80f, 0.20f);
	style.Colors[ImGuiCol_ModalWindowDimBg] = C_GET(ColorPickerVar_t, Vars.colPrimtv1).colValue.GetVec4(0.25f);

	C_GET(ColorPickerVar_t, Vars.colPrimtv0).UpdateRainbow();
	C_GET(ColorPickerVar_t, Vars.colPrimtv1).UpdateRainbow();
	C_GET(ColorPickerVar_t, Vars.colPrimtv2).UpdateRainbow();
	C_GET(ColorPickerVar_t, Vars.colPrimtv3).UpdateRainbow();

	C_GET(ColorPickerVar_t, Vars.colAccent0).UpdateRainbow();
	C_GET(ColorPickerVar_t, Vars.colAccent1).UpdateRainbow();
	C_GET(ColorPickerVar_t, Vars.colAccent2).UpdateRainbow();
}

#pragma region menu_tabs

void T::RageBot()
{
	ImVec2 content_avail = ImGui::GetContentRegionAvail();
	float group_width = (content_avail.x - ImGui::GetStyle().ItemSpacing.x) / 2.f;
	float group_height = content_avail.y - ImGui::GetFrameHeightWithSpacing() - ImGui::GetStyle().ItemSpacing.y; // Account for weapon buttons and separator

	int currentWeapon = GetWeaponIndex();
	currentWeapon = std::max(0, std::min(currentWeapon, 6));
	C_GET(int, Vars.iWeaponTypeSelected) = currentWeapon;

	const char* weapons[7]{ "Default", "Pistol", "Heavy", "Rifle", "SMG", "SSG", "AWP" };

	ImGui::BeginGroup();
	ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(2 * MENU::flDpiScale, 0));
	ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, ImVec2(0.5f, 0.5f)); // Center text in radio buttons
	float total_button_width = 0;
	for (int i = 0; i < IM_ARRAYSIZE(weapons); i++)
	{
		total_button_width += ImGui::CalcTextSize(weapons[i]).x + ImGui::GetStyle().FramePadding.x * 4 + ImGui::GetStyle().ItemSpacing.x;
	}
	total_button_width -= ImGui::GetStyle().ItemSpacing.x; // remove last spacing

	float cursor_start_x = (content_avail.x - total_button_width) / 2.f;
	ImGui::SetCursorPosX(cursor_start_x > 0 ? cursor_start_x : 0);

	for (int i = 0; i < IM_ARRAYSIZE(weapons); i++)
	{
		if (ImGui::RadioButton(weapons[i], &C_GET(int, Vars.iWeaponTypeSelected), i))
		{
			// Action on change if needed
		}
		if (i < IM_ARRAYSIZE(weapons) - 1)
			ImGui::SameLine();
	}
	ImGui::PopStyleVar(2);
	ImGui::EndGroup();
	ImGui::Separator();

	ImGui::BeginChildStyled("##Ragebot_Child_Left", ImVec2(group_width, group_height));
	{
		ImGui::Checkbox("Enable Ragebot##ragebot", &C_GET(bool, Vars.bRageBot));
		ImGui::Checkbox("Silent Aim", &C_GET(bool, Vars.bSilentAim));
		ImGui::SliderInt("FOV", &C_GET(int, Vars.iRageAimRange), 1, 180, "%d deg");
		ImGui::Checkbox("Autowall", &C_GET(bool, Vars.bAutoWall));
		ImGui::Checkbox("Auto Fire", &C_GET(bool, Vars.bAutoFire));

		ImGui::Text("Body Aim:");
		ImGui::SameLine();
		ImGui::HotKey("##bodyaimkey", &C_GET(KeyBind_t, Vars.nBodyAim));
		ImGui::Text("Force Safe:");
		ImGui::SameLine();

		ImGui::Separator();
		ImGui::Text("Hitboxes:");
		ImGui::Indent();
		for (int i = 0; i < IM_ARRAYSIZE(arrHitboxes); ++i)
		{
			bool selected = (C_GET_ARRAY(unsigned int, 7, Vars.bRageHitboxes, currentWeapon) & (1 << i));
			if (ImGui::Checkbox(arrHitboxes[i], &selected))
			{
				if (selected)
					C_GET_ARRAY(unsigned int, 7, Vars.bRageHitboxes, currentWeapon) |= (1 << i);
				else
					C_GET_ARRAY(unsigned int, 7, Vars.bRageHitboxes, currentWeapon) &= ~(1 << i);
			}
		}
		ImGui::Unindent();
	}
	ImGui::EndChildStyled();

	ImGui::SameLine();

	ImGui::BeginChildStyled("##Ragebot_Child_Right", ImVec2(group_width, group_height));
	{
		ImGui::SliderInt("Min Damage", &C_GET_ARRAY(int, 7, Vars.iMinDamage, currentWeapon), 1, 120);
		ImGui::Text("Override Dmg:");
		ImGui::SameLine();
		ImGui::HotKey("##overridedmgkey", &C_GET(KeyBind_t, Vars.nOverrideDamageActivationKey));
		ImGui::SliderInt("Override Damage", &C_GET_ARRAY(int, 7, Vars.iOverrideDamage, currentWeapon), 1, 120);
		ImGui::SliderInt("Penetration Count", &C_GET_ARRAY(int, 7, Vars.iPenetrationCount, currentWeapon), 1, 5);
		ImGui::SliderInt("Hit Chance", &C_GET_ARRAY(int, 7, Vars.iHitChance, currentWeapon), 0, 100, "%d%%");

		ImGui::Checkbox("Multipoint", &C_GET_ARRAY(bool, 7, Vars.bMultiPoint, currentWeapon));

		ImGui::Separator();
		ImGui::Checkbox("Auto Peek", &C_GET(bool, Vars.bAutoPeek));
		ImGui::Text("Auto Peek Key:");
		ImGui::SameLine();
		ImGui::HotKey("##autopeekkey", &C_GET(KeyBind_t, Vars.nAutoPeekKey));
	}
	ImGui::EndChildStyled();
}

void T::AntiAim()
{
	ImVec2 content_avail = ImGui::GetContentRegionAvail();
	float group_width = (content_avail.x - ImGui::GetStyle().ItemSpacing.x) / 2.f;
	float group_height = content_avail.y;

	ImGui::BeginChildStyled("##Antiaim_Left", ImVec2(group_width, group_height));
	{
		ImGui::Text("Antiaim Settings");
		ImGui::Separator();
		ImGui::Checkbox("Enable##antiaim", &C_GET(bool, Vars.bAntiaim));
		ImGui::Checkbox("Freestanding", &C_GET(bool, Vars.bFreestading));
		ImGui::BeginDisabled(!C_GET(bool, Vars.bAntiaim));
		{
			static const char* AntiaimPitchItems[]{ "UP", "DOWN", "ZERO", "FAKEDOWN" };
			ImGui::Combo("Pitch", &C_GET(int, Vars.iAntiaimPitch), AntiaimPitchItems, IM_ARRAYSIZE(AntiaimPitchItems));

			static const char* YawItems[]{ "Forward", "Backward", "Spinbot" };
			ImGui::Combo("Yaw Base", &C_GET(int, Vars.iYawBase), YawItems, IM_ARRAYSIZE(YawItems));

			static const char* AntiaimJitterTypeItems[]{ "NONE", "OFFSET", "CENTER", "RANDOM" };
			ImGui::Combo("Jitter Type", &C_GET(int, Vars.iJitterType), AntiaimJitterTypeItems, IM_ARRAYSIZE(AntiaimJitterTypeItems));
			ImGui::SliderInt("Jitter Range", &C_GET(int, Vars.iJitterAngle), 1, 180);

		}
		ImGui::EndDisabled();
	}
	ImGui::EndChildStyled();

	ImGui::SameLine();

	ImGui::BeginChildStyled("##Antiaim_Right", ImVec2(group_width, group_height));
	{
		ImGui::Text("Manuals");
		ImGui::Separator();

		ImGui::Text("Left Key:");
		ImGui::SameLine();
		ImGui::HotKey("##leftkey", &C_GET(KeyBind_t, Vars.nLeft));
		ImGui::Text("Right Key:");
		ImGui::SameLine();
		ImGui::HotKey("##rightkey", &C_GET(KeyBind_t, Vars.nRight));
		ImGui::Text("Backward Key:");
		ImGui::SameLine();
		ImGui::HotKey("##backwardkey", &C_GET(KeyBind_t, Vars.nBackward));
	}
	ImGui::EndChildStyled();
}

void T::Visuals()
{
	switch (nVisualTab)
	{
	case 0:
		T::VisualsPlayers();
		break;
	case 1:
		T::VisualsWeapons();
		break;
	case 2:
		T::VisualsWorld();
		break;
	case 3:
		T::VisualsView();
		break;
	default:
		break;
	}
}

void T::VisualsPlayers()
{
	ImVec2 content_avail = ImGui::GetContentRegionAvail();
	float group_width = (content_avail.x - ImGui::GetStyle().ItemSpacing.x) / 2.f;
	float group_height = content_avail.y;

	ImGui::BeginChildStyled("##PlayerEsp_Child", ImVec2(group_width, group_height));
	{
		ImGui::Text("Player ESP");
		ImGui::Separator();
		ImGui::Checkbox("Enable##player.esp", &C_GET(bool, Vars.bVisualOverlay));
		ImGui::BeginDisabled(!C_GET(bool, Vars.bVisualOverlay));
		{
			ImGui::Checkbox("Bounding box", &C_GET(FrameOverlayVar_t, Vars.overlayBox).bEnable);
			ImGui::SameLine();
			ImGui::ColorEdit4("##bboxcol", &C_GET(FrameOverlayVar_t, Vars.overlayBox).colPrimary, ALPHA);
			ImGui::Checkbox("Name", &C_GET(TextOverlayVar_t, Vars.overlayName).bEnable);
			ImGui::SameLine();
			ImGui::ColorEdit4("##namecol", &C_GET(TextOverlayVar_t, Vars.overlayName).colPrimary, ALPHA);
			ImGui::Checkbox("Weapon Name", &C_GET(TextOverlayVar_t, Vars.overlayWeaponName).bEnable);
			ImGui::SameLine();
			ImGui::ColorEdit4("##wepnamecol", &C_GET(TextOverlayVar_t, Vars.overlayWeaponName).colPrimary, ALPHA);
			ImGui::Checkbox("Weapon Icon", &C_GET(TextOverlayVar_t, Vars.overlayWeaponIcons).bEnable);
			ImGui::SameLine();
			ImGui::ColorEdit4("##wepiconcol", &C_GET(TextOverlayVar_t, Vars.overlayWeaponIcons).colPrimary, ALPHA);
			ImGui::Checkbox("Health bar", &C_GET(BarOverlayVar_t, Vars.overlayHealthBar).bEnable);
			ImGui::SameLine();
			ImGui::ColorEdit4("##healthcol", &C_GET(BarOverlayVar_t, Vars.overlayHealthBar).colPrimary, ALPHA);
			ImGui::Checkbox("Armor bar", &C_GET(BarOverlayVar_t, Vars.overlayArmorBar).bEnable);
			ImGui::SameLine();
			ImGui::ColorEdit4("##armorcol", &C_GET(BarOverlayVar_t, Vars.overlayArmorBar).colPrimary, ALPHA);

			ImGui::Text("Flags:");
			ImGui::Indent();
			for (int i = 0; i < IM_ARRAYSIZE(arrEspFlags); ++i)
			{
				bool selected = (C_GET(unsigned int, Vars.pEspFlags) & (1 << i));
				if (ImGui::Checkbox(arrEspFlags[i], &selected))
				{
					if (selected)
						C_GET(unsigned int, Vars.pEspFlags) |= (1 << i);
					else
						C_GET(unsigned int, Vars.pEspFlags) &= ~(1 << i);
				}
			}
			ImGui::Unindent();
		}
		ImGui::EndDisabled();

		ImGui::Separator();
		ImGui::Text("Player Glow");
		ImGui::Separator();
		ImGui::Checkbox("Enable##player.glow", &C_GET(bool, Vars.bVisualGlow));
		ImGui::BeginDisabled(!C_GET(bool, Vars.bVisualGlow));
		{
			ImGui::ColorEdit4("Enemy color##glow", &C_GET(Color_t, Vars.colGlowEnemy), NO_ALPHA);
			ImGui::ColorEdit4("Team color##glow", &C_GET(Color_t, Vars.colGlowTeam), NO_ALPHA);
		}
		ImGui::EndDisabled();
	}
	ImGui::EndChildStyled();

	ImGui::SameLine();

	ImGui::BeginChildStyled("##PlayerChams_Child", ImVec2(group_width, group_height));
	{
		ImGui::Text("Player Chams");
		ImGui::Separator();
		ImGui::Checkbox("Enable Player Chams", &C_GET(bool, Vars.bPlayerChams));
		ImGui::Checkbox("Enable Ragdoll Chams", &C_GET(bool, Vars.bRagdollChams));
		ImGui::Checkbox("Enable Team Chams", &C_GET(bool, Vars.bTeamChams));
		ImGui::Checkbox("Enable Invisible Chams", &C_GET(bool, Vars.bVisualChamsIgnoreZ));

		ImGui::Separator();

		const char* materials[] = { "Default", "Flat", "Glow", "Glass", "Metallic" }; // Example materials
		ImGui::Combo("Visible material", &C_GET(int, Vars.nVisualChamsVisibleMaterial), materials, IM_ARRAYSIZE(materials));
		if (C_GET(bool, Vars.bVisualChamsIgnoreZ))
			ImGui::Combo("Invisible material", &C_GET(int, Vars.nVisualChamsInvisibleMaterial), materials, IM_ARRAYSIZE(materials));

		ImGui::Separator();

		ImGui::Text("Enemy:");
		ImGui::SameLine();
		ImGui::ColorEdit4("Visible##chamsenemy", &C_GET(Color_t, Vars.colVisualChamsEnemy), NO_ALPHA);
		if (C_GET(bool, Vars.bVisualChamsIgnoreZ))
		{
			ImGui::SameLine();
			ImGui::ColorEdit4("Invisible##chamsenemy", &C_GET(Color_t, Vars.colVisualChamsEnemyIgnoreZ), NO_ALPHA);
		}

		ImGui::Text("Team: ");
		ImGui::SameLine();
		ImGui::ColorEdit4("Visible##chamsteam", &C_GET(Color_t, Vars.colVisualChamsTeam), NO_ALPHA);
		if (C_GET(bool, Vars.bVisualChamsIgnoreZ))
		{
			ImGui::SameLine();
			ImGui::ColorEdit4("Invisible##chamsteam", &C_GET(Color_t, Vars.colVisualChamsTeamIgnoreZ), NO_ALPHA);
		}
	}
	ImGui::EndChildStyled();
}

void T::VisualsWeapons()
{
	ImVec2 content_avail = ImGui::GetContentRegionAvail();
	float group_width = (content_avail.x - ImGui::GetStyle().ItemSpacing.x) / 2.f;
	float group_height = content_avail.y;

	ImGui::BeginChildStyled("##WeaponEsp_Child", ImVec2(group_width, group_height));
	{
		ImGui::Text("Weapon ESP");
		ImGui::Separator();
		ImGui::TextDisabled("Coming soon...");
	}
	ImGui::EndChildStyled();

	ImGui::SameLine();

	ImGui::BeginChildStyled("##WeaponChams_Child", ImVec2(group_width, group_height));
	{
		ImGui::Text("Weapon Chams");
		ImGui::Separator();
		ImGui::Checkbox("Enable Weapon Chams", &C_GET(bool, Vars.bWeaponChams));
		ImGui::BeginDisabled(!C_GET(bool, Vars.bWeaponChams));
		{
			const char* materials[] = { "Default", "Flat", "Glow", "Glass", "Metallic" };
			ImGui::Combo("Weapon Material", &C_GET(int, Vars.nVisualChamsWeaponMaterial), materials, IM_ARRAYSIZE(materials));
			ImGui::ColorEdit4("Weapon Color", &C_GET(Color_t, Vars.colVisualChamsWeapon), NO_ALPHA);
		}
		ImGui::EndDisabled();

		ImGui::Separator();

		ImGui::Checkbox("Enable C4 Chams", &C_GET(bool, Vars.bC4Chams));
		ImGui::BeginDisabled(!C_GET(bool, Vars.bC4Chams));
		{
			const char* materials[] = { "Default", "Flat", "Glow", "Glass", "Metallic" };
			ImGui::Combo("C4 Material", &C_GET(int, Vars.nVisualChamsC4Material), materials, IM_ARRAYSIZE(materials));
			ImGui::ColorEdit4("C4 Color", &C_GET(Color_t, Vars.colVisualChamsC4), NO_ALPHA);
		}
		ImGui::EndDisabled();
	}
	ImGui::EndChildStyled();
}

void T::VisualsWorld()
{
	ImVec2 content_avail = ImGui::GetContentRegionAvail();
	float group_width = (content_avail.x - ImGui::GetStyle().ItemSpacing.x) / 2.f;
	float group_height = content_avail.y;

	ImGui::BeginChildStyled("##VisualWorld_Left", ImVec2(group_width, group_height));
	{
		ImGui::Text("World Modulation");
		ImGui::Separator();
		ImGui::Checkbox("Night Mode", &C_GET(bool, Vars.bNightMode));
		ImGui::ColorEdit4("World Light", &C_GET(Color_t, Vars.colLight), NO_ALPHA);
		ImGui::SliderInt("Light Intensity", &C_GET(int, Vars.nLightingIntensity), 0, 600);
		ImGui::SliderInt("Ambient Intensity", &C_GET(int, Vars.nBrightness), 1, 200);
		ImGui::ColorEdit4("World Color", &C_GET(Color_t, Vars.colWorld), NO_ALPHA);
		ImGui::ColorEdit4("Skybox Color", &C_GET(Color_t, Vars.colSkybox), NO_ALPHA);
	}
	ImGui::EndChildStyled();

	ImGui::SameLine();

	ImGui::BeginChildStyled("##VisualWorld_Right", ImVec2(group_width, group_height));
	{
		ImGui::Text("Removals");
		ImGui::Separator();
		ImGui::Checkbox("Remove Smoke", &C_GET(bool, Vars.bShowSmoke));
		ImGui::Checkbox("Remove Scope Overlay", &C_GET(bool, Vars.bDrawScope));
		ImGui::Checkbox("Remove Visual Punch", &C_GET(bool, Vars.bRemoveVisualPunch));
		ImGui::Checkbox("Remove Legs", &C_GET(bool, Vars.bRemoveLegs));
	}
	ImGui::EndChildStyled();
}

void T::VisualsView()
{
	ImVec2 content_avail = ImGui::GetContentRegionAvail();
	float group_width = (content_avail.x - ImGui::GetStyle().ItemSpacing.x) / 2.f;
	float group_height = content_avail.y;

	ImGui::BeginChildStyled("##VisualsCamera_Child", ImVec2(group_width, group_height));
	{
		ImGui::Text("Camera");
		ImGui::Separator();
		ImGui::SliderInt("Field of View", &C_GET(int, Vars.iFov), 50, 160);
		ImGui::Checkbox("Static FOV in Scope?", &C_GET(bool, Vars.bStaticFovInScope));
		ImGui::Checkbox("Force Crosshair", &C_GET(bool, Vars.bForceCrosshair));

		ImGui::Separator();
		ImGui::Text("Thirdperson");
		ImGui::Checkbox("Enable", &C_GET(bool, Vars.bThirdPerson));
		ImGui::Text("Enable Key:");
		ImGui::SameLine();
		ImGui::HotKey("##thirdpersonkey", &C_GET(KeyBind_t, Vars.nThirdPersonActivationKey));
		ImGui::Checkbox("Thirdperson while Spectating", &C_GET(bool, Vars.bThirdPersonInSpec));
		ImGui::SliderInt("Distance", &C_GET(int, Vars.iThirdPersonDistance), 50, 400);

		ImGui::Separator();
		ImGui::Text("Aspect Ratio");
		ImGui::Checkbox("Enable##aspect", &C_GET(bool, Vars.bAspectRatio));
		ImGui::BeginDisabled(!C_GET(bool, Vars.bAspectRatio));
		ImGui::SliderFloat("Value##aspect", &C_GET(float, Vars.flAspectRatio), 0.1f, 3.f, "%.2f");
		ImGui::EndDisabled();
	}
	ImGui::EndChildStyled();

	ImGui::SameLine();

	ImGui::BeginChildStyled("##ViewModel_Child", ImVec2(group_width, group_height));
	{
		ImGui::Text("Viewmodel");
		ImGui::Separator();
		ImGui::SliderFloat("Offset X", &C_GET(float, Vars.flViewModelOffsetX), -15.f, 15.f, "%.2f");
		ImGui::SliderFloat("Offset Y", &C_GET(float, Vars.flViewModelOffsetY), -15.f, 15.f, "%.2f");
		ImGui::SliderFloat("Offset Z", &C_GET(float, Vars.flViewModelOffsetZ), -15.f, 15.f, "%.2f");
		ImGui::EndDisabled();
	}
	ImGui::EndChildStyled();
}

void T::Miscellaneous()
{
	ImVec2 content_avail = ImGui::GetContentRegionAvail();
	float group_width = (content_avail.x - ImGui::GetStyle().ItemSpacing.x) / 2.f;
	float group_height = content_avail.y;

	ImGui::BeginChildStyled("##MiscGeneral_Child", ImVec2(group_width, group_height));
	{
		ImGui::Text("General");
		ImGui::Separator();
		ImGui::Checkbox("Anti-Untrusted Mode", &C_GET(bool, Vars.bAntiUntrusted));
		ImGui::Checkbox("Debug Shoot Hitbox", &C_GET(bool, Vars.bDebugShootHitbox));
		ImGui::Checkbox("Auto Scope", &C_GET(bool, Vars.bAutoScope));

		ImGui::Checkbox("Hit Marker", &C_GET(bool, Vars.bHitmarker));

		ImGui::Checkbox("Spectator List", &C_GET(bool, Vars.bSpectatorList));
		ImGui::Checkbox("KeyBind list", &C_GET(bool, Vars.bKeybindList));
		ImGui::Checkbox("Watermark", &C_GET(bool, Vars.bWatermark));

		ImGui::Separator();
		ImGui::Text("Bullet Tracers");
		ImGui::Checkbox("Enemy", &C_GET(bool, Vars.bBulletTraceEnemy));
		ImGui::SameLine();
		ImGui::ColorEdit4("##enemytracecol", &C_GET(Color_t, Vars.colBulletTraceEnemy), NO_ALPHA);
		ImGui::Checkbox("Local", &C_GET(bool, Vars.bBulletTraceLocal));
		ImGui::SameLine();
		ImGui::ColorEdit4("##localtracecol", &C_GET(Color_t, Vars.colBulletTraceLocal), NO_ALPHA);
	}
	ImGui::EndChildStyled();

	ImGui::SameLine();

	ImGui::BeginChildStyled("##MiscMovement_Child", ImVec2(group_width, group_height));
	{
		ImGui::Text("Movement");
		ImGui::Separator();
		ImGui::Checkbox("Auto Bunny-hopping", &C_GET(bool, Vars.bAutoBHop));
		ImGui::BeginDisabled(!C_GET(bool, Vars.bAutoBHop));
		{
			ImGui::SliderInt("Chance##bhop", &C_GET(int, Vars.nAutoBHopChance), 0, 100, "%d%%");
		}
		ImGui::EndDisabled();
		ImGui::Checkbox("Auto Strafe", &C_GET(bool, Vars.bAutoStrafe));
		ImGui::Checkbox("Auto Stop", &C_GET(bool, Vars.bAutoStop));
	}
	ImGui::EndChildStyled();
}

void T::Configs()
{
	ImVec2 content_avail = ImGui::GetContentRegionAvail();
	float list_width = (content_avail.x - ImGui::GetStyle().ItemSpacing.x) * 0.4f;
	float controls_width = (content_avail.x - ImGui::GetStyle().ItemSpacing.x) * 0.6f;
	float group_height = content_avail.y;

	ImGui::BeginChildStyled("##ConfigList_Child", ImVec2(list_width, group_height));
	{
		ImGui::Text("Configurations");
		ImGui::Separator();

		if (C::vecFileNames.empty())
		{
			C::Refresh();
		}

		if (nSelectedConfig == -1 && !C::vecFileNames.empty())
		{
			bool foundDefault = false;
			for (std::size_t i = 0U; i < C::vecFileNames.size(); i++)
			{
				if (CRT::StringCompare(C::vecFileNames[i], CS_CONFIGURATION_DEFAULT_FILE_NAME CS_CONFIGURATION_FILE_EXTENSION) == 0)
				{
					nSelectedConfig = i;
					foundDefault = true;
					break;
				}
			}
			if (!foundDefault)
			{
				nSelectedConfig = 0;
			}
		}

		float list_box_height = ImGui::GetContentRegionAvail().y - ImGui::GetFrameHeightWithSpacing() - ImGui::GetStyle().ItemSpacing.y;
		if (ImGui::BeginListBox("##config.list", ImVec2(-1, list_box_height)))
		{
			for (std::size_t i = 0U; i < C::vecFileNames.size(); i++)
			{
				const wchar_t* wszFileName = C::vecFileNames[i];
				char szFileName[MAX_PATH] = {};
				CRT::StringUnicodeToMultiByte(szFileName, CS_ARRAYSIZE(szFileName), wszFileName);

				if (ImGui::Selectable(szFileName, (nSelectedConfig == i)))
					nSelectedConfig = i;
			}
			ImGui::EndListBox();
		}

		ImGui::PushItemWidth(-1);
		if (ImGui::InputTextWithHint("##config.file", "Create new configuration...", szConfigFile, sizeof(szConfigFile), ImGuiInputTextFlags_EnterReturnsTrue))
		{
			if (const std::size_t nConfigFileLength = CRT::StringLength(szConfigFile); nConfigFileLength > 0U)
			{
				CRT::WString_t wszConfigFile(szConfigFile);
				if (C::CreateFile(wszConfigFile.Data()))
				{
					C::Refresh();
					for (size_t i = 0; i < C::vecFileNames.size(); ++i)
					{
						if (CRT::StringCompare(wszConfigFile.Data(), C::vecFileNames[i]) == 0)
						{
							nSelectedConfig = i;
							break;
						}
					}
				}
				CRT::MemorySet(szConfigFile, 0U, sizeof(szConfigFile));
			}
		}
		if (ImGui::IsItemHovered())
			ImGui::SetTooltip("Press enter to create");
		ImGui::PopItemWidth();
	}
	ImGui::EndChildStyled();

	ImGui::SameLine();

	ImGui::BeginChildStyled("##ConfigControls_Child", ImVec2(controls_width, group_height));
	{
		ImGui::Text("Actions");
		ImGui::Separator();
		ImGui::BeginDisabled(nSelectedConfig < 0 || static_cast<size_t>(nSelectedConfig) >= C::vecFileNames.size());
		{
			if (ImGui::Button("Save Configuration", ImVec2(-1, 0)))
				C::SaveFile(nSelectedConfig);
			if (ImGui::Button("Load Configuration", ImVec2(-1, 0)))
				C::LoadFile(nSelectedConfig);

			ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.6f, 0.2f, 0.2f, 1.0f)); // Red button
			ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(0.8f, 0.3f, 0.3f, 1.0f));
			ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(0.9f, 0.2f, 0.2f, 1.0f));
			if (ImGui::Button("Remove Configuration", ImVec2(-1, 0)))
				ImGui::OpenPopup("Confirmation Config");
			ImGui::PopStyleColor(3);
		}
		ImGui::EndDisabled();

		ImGui::Separator();

		if (ImGui::Button("Refresh List", ImVec2(-1, 0)))
		{
			C::Refresh();
			nSelectedConfig = -1;
		}

		if (ImGui::BeginPopupModal("Confirmation Config", nullptr, ImGuiWindowFlags_NoResize | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove))
		{
			if (nSelectedConfig >= 0 && static_cast<size_t>(nSelectedConfig) < C::vecFileNames.size())
			{
				CRT::String_t<MAX_PATH> szCurrentConfig(C::vecFileNames[nSelectedConfig]);
				ImGui::Text("Are you sure you want to remove \"%s\"?", szCurrentConfig);
			}
			else
			{
				ImGui::Text("Error: No configuration selected or index out of bounds.");
			}
			ImGui::Spacing();

			if (ImGui::Button("No", ImVec2(ImGui::GetContentRegionAvail().x / 2.f - ImGui::GetStyle().ItemSpacing.x / 2.f, 0)))
				ImGui::CloseCurrentPopup();

			ImGui::SameLine();

			ImGui::BeginDisabled(nSelectedConfig < 0 || static_cast<size_t>(nSelectedConfig) >= C::vecFileNames.size());
			if (ImGui::Button("Yes", ImVec2(ImGui::GetContentRegionAvail().x, 0)))
			{
				if (nSelectedConfig >= 0 && static_cast<size_t>(nSelectedConfig) < C::vecFileNames.size())
				{
					C::RemoveFile(nSelectedConfig);
					C::Refresh();
					nSelectedConfig = -1;
				}
				ImGui::CloseCurrentPopup();
			}
			ImGui::EndDisabled();

			ImGui::EndPopup();
		}
	}
	ImGui::EndChildStyled();
}

#pragma endregion

#pragma region menu_particle

static constexpr float maxRadius = 15.f;

float min(float a, float b)
{
	return (((a) < (b)) ? (a) : (b));
}

float max(float a, float b)
{
	return (((a) > (b)) ? (a) : (b));
}

float Constrain(float n, float low, float high)
{
	return max(min(n, high), low);
}

float Map(float n, float start1, float stop1, float start2, float stop2, bool withinBounds = false)
{
	const float newVal = (n - start1) / (stop1 - start1) * (stop2 - start2) + start2;
	if (!withinBounds)
		return newVal;
	if (start2 < stop2)
		return Constrain(newVal, start2, stop2);
	else
		return Constrain(newVal, stop2, start2);
}

float RandomFloat(float a, float b)
{
	float random = ((float)rand()) / (float)RAND_MAX;
	float diff = b - a;
	float r = random * diff;
	return a + r;
}

float GetRandomSize(float min_r, float max_r)
{
	float r = pow(RandomFloat(0.f, 1.f), 3);
	return Constrain(r * max_r, min_r, max_r);
}

void MENU::ParticleContext_t::Render(ImDrawList* pDrawList, const ImVec2& vecScreenSize, const float flAlpha)
{
	if (this->vecParticles.empty())
	{
		for (int i = 0; i < 100; i++)
			this->AddParticle(vecScreenSize);
	}

	ImColor particleColor = C_GET(ColorPickerVar_t, Vars.colAccent0).colValue.GetU32(); // Base color from accent

	for (auto& particle : this->vecParticles)
	{
		particleColor.Value.w = (particle.radius / maxRadius) * flAlpha * 0.7f; // Modulate alpha and make slightly dimmer
		this->DrawParticle(pDrawList, particle, particleColor);
		this->UpdatePosition(particle, vecScreenSize);
		// Connections are very costly, only enable if performance allows
		// ImColor connectionColor = C_GET(ColorPickerVar_t, Vars.colAccent1).colValue.GetU32();
		// connectionColor.Value.w *= flAlpha * 0.5f; // Dimmer connections
		// this->FindConnections(pDrawList, particle, connectionColor, 120.f * MENU::flDpiScale);
	}
}

void MENU::ParticleContext_t::AddParticle(const ImVec2& vecScreenSize)
{
	if (this->vecParticles.size() >= 200UL) // Reduced max particles for performance
		return;

	this->vecParticles.emplace_back(
	ImVec2(RandomFloat(0.f, vecScreenSize.x), RandomFloat(-50.f * MENU::flDpiScale, -5.f * MENU::flDpiScale)), // Start off-screen top
	ImVec2(RandomFloat(-0.2f, 0.2f), RandomFloat(0.3f, 1.2f)), // Slight horizontal variation, mostly downwards velocity
	ImVec2(0, 0), // Initial acceleration
	GetRandomSize(2.f * MENU::flDpiScale, maxRadius * MENU::flDpiScale * 0.7f)); // Smaller radius
}

void MENU::ParticleContext_t::DrawParticle(ImDrawList* pDrawList, ParticleData_t& particle, const ImColor& colPrimary)
{
	pDrawList->AddCircleFilled(particle.vecPosition, particle.radius, colPrimary, 8); // Reduced segments
}

void MENU::ParticleContext_t::FindConnections(ImDrawList* pDrawList, ParticleData_t& particle, const ImColor& colPrimary, float flMaxDistance)
{
	float maxDistSq = flMaxDistance * flMaxDistance;
	for (auto& currentParticle : this->vecParticles)
	{
		if (&currentParticle == &particle)
			continue;

		ImVec2 delta = particle.vecPosition - currentParticle.vecPosition;
		float distSq = delta.x * delta.x + delta.y * delta.y;

		if (distSq <= maxDistSq && distSq > 1.0f) // Avoid connecting to self or very close particles
		{
			float dist = sqrtf(distSq);
			float alphaFactor = (flMaxDistance - dist) / flMaxDistance;
			this->DrawConnection(pDrawList, particle, currentParticle, alphaFactor * alphaFactor, colPrimary); // Squared alpha for faster fade
		}
	}
}

void MENU::ParticleContext_t::DrawConnection(ImDrawList* pDrawList, ParticleData_t& particle, ParticleData_t& otherParticle, float flAlphaFactor, const ImColor& colPrimary) const
{
	ImColor connectionColor = colPrimary;
	connectionColor.Value.w *= flAlphaFactor; // Modulate alpha
	pDrawList->AddLine(particle.vecPosition, otherParticle.vecPosition, connectionColor, 1.0f * MENU::flDpiScale);
}

void MENU::ParticleContext_t::UpdatePosition(ParticleData_t& particle, const ImVec2& vecScreenSize) const
{
	float dt = ImGui::GetIO().DeltaTime;
	// Simple linear motion, scaled by DPI and speed factor
	particle.vecPosition += particle.vecVelocity * dt * 60.f * MENU::flDpiScale;

	this->ResolveScreenCollision(particle, vecScreenSize);
}

void MENU::ParticleContext_t::ResolveScreenCollision(ParticleData_t& particle, const ImVec2& vecScreenSize) const
{
	// Reset particle when it goes off the bottom or sides
	if (particle.vecPosition.y > vecScreenSize.y + particle.radius * 2.f || particle.vecPosition.x < -particle.radius * 2.f || particle.vecPosition.x > vecScreenSize.x + particle.radius * 2.f)
	{
		particle.vecPosition = ImVec2(RandomFloat(0.f, vecScreenSize.x), -particle.radius * 2.f); // Reset to top
		particle.vecVelocity = ImVec2(RandomFloat(-0.2f, 0.2f), RandomFloat(0.3f, 1.2f)); // Reset velocity
		particle.radius = GetRandomSize(2.f * MENU::flDpiScale, maxRadius * MENU::flDpiScale * 0.7f); // Reset size
	}
}

#pragma endregion

give complete code to me(only give me menu.cpp file), ensure all function are complete, and the code isnt example, simple code or minimal edit code.